<extend name="layout/edit" />

<block name="HEADER">
	
</block>

<block name="CONTENT">
	<div style="height: calc(100% - 42px);">
		<control:grid id="selectUserGrid" padding="0" height="100%" />
	</div>
	<div class="xw-form">
		<div class="xw-btnRow" style="text-align: right;">
			<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" onclick="page.save()" >
				确认选择
			</button> 
			<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" onclick="$.close()">
				关闭
			</button>
		</div>
	</div>
</block>

<block name="FOOTER">
	<script type="text/javascript">
		var page = (function(ns) {
			
			ns.selectedIds = [];
			
			ns.init = function(){
				selectUserGrid.queryFront(function(res){
					//var uids = parent.__selectUserIds || $.getRequest('user_ids');
					//if(uids) res.push({"field":"id","opera":"in","value": uids });
					return res;
				});
			}
			//搜索事件
			ns.save = function() {
				var ids = selectUserGrid.getSelectedColumnValue('id'); 
				var datas = selectUserGrid.getSelectedRows(); 
				if(!ids){
					$.toast(0,"请先选择用户！");
					return false;
				}
				if( parent.page && parent.page.selectUserCallback){
					if(parent.page.selectUserCallback(ids,datas) !== false){
						$.close();
					}
				}else{
					$.close();
				}
			}

			return ns;
		}({}));

		$(function() { page.init(); });
	</script>
</block>